package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * @Author: Worker Hu
 * @CreateTime: 2024-06-28  15:02
 */
@Data
public class LeaseException extends RuntimeException{

    private static final long serialVersionUID = 1L;

    private Integer code;

    public LeaseException(String message,Integer code){
        super(message);
        this.code=code;
    }

    public LeaseException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code=resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "LeaseException{" +
                "code=" + code +
                ", message='" + super.getMessage() + '\'' +
                '}';
    }
}


